package cxy.highConcurrency;

import java.util.concurrent.CompletableFuture;

public class CompletableFutureDemo_2 {
	public static void main(String[] args) {
		
		System.out.println("1:" + Thread.currentThread().getName());

		CompletableFuture<String> f0 = CompletableFuture.supplyAsync(() ->{System.out.println("2:" + Thread.currentThread().getName());
		return "Hello World";}) // ①
				.thenApply(s -> {System.out.println("3:" + Thread.currentThread().getName());
				return s + " QQ";}) // ②
				.thenApply(String::toUpperCase);// ③

		System.out.println(f0.join());
	}
}
